home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d18 / mou105.arc / PTEST.PAS < prev    next >
Pascal/Delphi Source File  |  1991-09-29  |  4KB  |  124 lines

  1. {****************************************************************************
  2.  * PROJECT:  Mouse routines with 'real' graphic cursor in text mode.
  3.  *****************************************************************************
  4.  * MODULE:  PTEST.PAS
  5.  *****************************************************************************
  6.  * DESCRIPTION:
  7.  *   Test program - translation of TEST.C to Turbo Pascal
  8.  *
  9.  *
  10.  *****************************************************************************
  11.  * MODIFICATION NOTES:
  12.  *    Date     Author Comment
  13.  * 26-Oct-1990   dk   Initial file.
  14.  * 07-Jan-1991   dk   Fixed bugs and set up for release to Usenet.
  15.  * 09-Jan-1991   dm   Translated to TP; uses direct writes instead of ANSI
  16.  * 27-Jan-1991   dk   Cleaned up the translation.
  17.  *****************************************************************************
  18.  *
  19.  * DISCLAIMER:
  20.  *
  21.  * Programmers may incorporate any or all code into their programs,
  22.  * giving proper credit within the source. Publication of the
  23.  * source routines is permitted so long as proper credit is given
  24.  * to Dave Kirsch.
  25.  *
  26.  * Copyright (C) 1990, 1991 by Dave Kirsch.  You may use this program, or
  27.  * code or tables extracted from it, as desired without restriction.
  28.  * I can not and will not be held responsible for any damage caused from
  29.  * the use of this software.
  30.  *
  31.  *****************************************************************************
  32.  * This source works with Turbo Pascal 6.0
  33.  ****************************************************************************}
  34.  
  35. uses
  36.   Crt,
  37.   Mou;
  38.  
  39. var
  40.   m : minforectype;
  41.  
  42. const
  43.   oldmx : integer = -1;
  44.   oldmy : integer = -1;
  45.  
  46. begin
  47.   MOUinit;
  48.   MOUshow;
  49.  
  50.   if (not mouseinstalled) then
  51.   begin
  52.     writeln('Please install your mouse driver before running this test ',
  53.            'program.');
  54.     halt;
  55.   end;
  56.  
  57.   MOUhide;
  58.   clrscr; { Clear the screen. }
  59.  
  60.   gotoxy(1,5);    write('Click here [■] with left mouse button to quit.');
  61.   gotoxy(1,7);    write('Mouse routine demonstration program [Turbo Pascal 6.0 Version].');
  62.   gotoxy(1,8);    write('With ''true'' EGA/VGA mouse cursor.');
  63.   gotoxy(1,9);    write('Copyright (C) 1990, 1991 by Dave Kirsch [a563@mindlink.UUCP].');
  64.   gotoxy(1,10); write('Pascal translation by Duncan Murdoch [dmurdoch@watstat.waterloo.edu].');
  65.  
  66.   MOUshow;
  67.  
  68.   repeat
  69.     if (mousex <> oldmx) or (mousey <> oldmy) then
  70.     begin
  71.       oldmx := mousex;
  72.       oldmy := mousey;
  73.       MOUconditionalhide(0, 0, 50, 0);
  74.       gotoxy(1,1); write('Mouse position: ',mousex:3,', ', mousey:3);
  75.       MOUshow;
  76.     end;
  77.  
  78.     if (MOUcheck) then
  79.     begin { If mouse event waiting in buffer... }
  80.       MOUget(m);
  81.       MOUconditionalhide(0, 1, 50, 2);
  82.       if (m.buttonstat and LEFTBPRESS) <> 0 then
  83.       begin
  84.         gotoxy(1,2);
  85.         write('Left button pressed at  ',m.cx:3,', ', m.cy:3);
  86.       end;
  87.       if (m.buttonstat and LEFTBRELEASE) <> 0 then
  88.       begin
  89.         gotoxy(1,2);
  90.         write('Left button released at ',m.cx:3,', ', m.cy:3);
  91.       end;
  92.       if (m.buttonstat and RIGHTBPRESS) <> 0 then
  93.       begin
  94.         gotoxy(1,3);
  95.         write('Right button pressed at  ',m.cx:3,', ', m.cy:3);
  96.       end;
  97.       if (m.buttonstat and RIGHTBRELEASE) <> 0 then
  98.       begin
  99.         gotoxy(1,3);
  100.         write('Right button released at ',m.cx:3,', ', m.cy:3);
  101.       end;
  102.       if (m.buttonstat and MIDBPRESS) <> 0 then
  103.       begin
  104.     gotoxy(1,4);
  105.         write('Middle button pressed at  ',m.cx:3,', ', m.cy:3);
  106.       end;
  107.       if (m.buttonstat and MIDBRELEASE) <> 0 then
  108.       begin
  109.     gotoxy(1,4);
  110.         write('Middle button released at ',m.cx:3,', ', m.cy:3);
  111.       end;
  112.       MOUshow;
  113.  
  114.       if ((m.buttonstat and LEFTBPRESS) <> 0)
  115.          and (m.cx > 11) and (m.cx < 14) and (m.cy = 4) then
  116.       begin
  117.         MOUdeinit;
  118.         clrscr; { Clear the screen. }
  119.         halt;
  120.       end
  121.     end
  122.   until false;
  123. end.
  124.